#ifndef SokobanState_H
#define SokobanState_H

#include <Ogre.h>
//#include <deque>
//using namespace std;

#include "GameState.h"
#include "PauseState.h"
#include "AudioManager.h"
//#include "OgreOSMScene.h"

class SokobanState : public GameState {
public:
    ~SokobanState( void );

    void enter( void );
    void exit( void );

    void pause( void );
    void resume( void );
    void update( unsigned long lTimeElapsed );

    void keyPressed( const OIS::KeyEvent &e );
    void keyReleased( const OIS::KeyEvent &e );

	//void frameStarted(const Ogre::FrameEvent &evt);
	//void frameEnded(const Ogre::FrameEvent &evt);

	void onMousePressedLeft(const OIS::MouseEvent &e);

    void mouseMoved( const OIS::MouseEvent &e );
    void mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id );
    void mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id );

	void createCamera();
	void createScene();
	bool checkRayHitWithNode(Ogre::Vector3 rv, Ogre::String str);

    static SokobanState* getSingletonPtr( void );
private:
    SokobanState( void ) { }
    SokobanState( const SokobanState& ) { }
    SokobanState & operator = ( const SokobanState& );

    Ogre::Overlay        *mInfoOverlay;
    Ogre::Overlay        *mPlayOverlay;
    Ogre::Overlay        *mMouseOverlay;
    Ogre::OverlayElement *mMousePointer;
    Ogre::OverlayElement *mInfoInstruction;
    Ogre::OverlayElement *mInfoNotification;

    OIS::Keyboard			*mInputDevice;

	bool keyIsDown, solved;
	Ogre::Vector3 camTrans, playerTrans, tempTrans, SpotVector;
	char level_array;
	int level_rows, level_cols, maxH, fireBoxPlaced, fireSpotTotal, waterBoxPlaced, waterSpotTotal, totalStep;

	//std::deque<Ogre::String> SpotList;
	//std::deque<Ogre::String> SpotListTmp;
	Ogre::String		SpotList, FireColList, WaterColList, WallColList, yourBox, oppBox;
	Ogre::StringVector	SpotListSplit, FireColListSplit, WaterColListSplit, WallColListSplit;
	Ogre::SceneNode		*curNode, *curPlayer, *lastHitNode, *curBox;
	Ogre::Real			moveSpeed, camSpeed;
	Ogre::Quaternion	pfQuat, pwQuat;
	//Ogre::Vector3		mDirection, mDestination;
	Ogre::RaySceneQuery	*mRaySceneQuery;

    static SokobanState *mSokobanState;
};
#endif